package com.rsk.dao.extend;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;


@Component
public class SysRoleMenuExtend {
	
	public String insertSql(){
		String sql = "INSERT INTO sys_role_menu(id,role_id,menu_id,operator_user,operator_time) VALUES (:Id,:roleId,:menuId,:operatorUser,:operatorTime)";
		return sql;
	}
	
	public Map<String, Object> selectByPage(String account){
		 // 拼接SQL语句
        StringBuilder sql = new StringBuilder("SELECT id FROM sys_users Where 1=1 ");
        StringBuilder countSql = new StringBuilder("SELECT count(id) FROM sys_users Where 1=1 ");
        
        // 查询需要的参数，先存进Map
        StringBuilder paramSql = new StringBuilder();
        Map<String, Object> paramMap = new HashMap<String, Object>();
        if (account != null && !account.isEmpty()) {
        	paramSql.append("account like :account");
        	paramMap.put("account", "%" + account + "%");
        }
        
        //排序
        StringBuilder orderSql = new StringBuilder();
        
        Map<String, Object> returnMap = new HashMap<String, Object>();
        returnMap.put("sql", sql.append(paramSql).append(orderSql));
        returnMap.put("countSQL", countSql.append(paramSql).append(orderSql));
        returnMap.put("paramMap", paramMap);
		return returnMap;
	}
}
 